#include <board.h>
#include <gui/lcd.h>
#include <sdram/sdram.h>


#define THREAD_STACK_SIZE 2048
#define THREAD_NAME "lcd_task"

static rt_thread_t lcd_thread;

extern int gui_app_start(int lcd_w, int lcd_h);

void lcd_entry(void *p)
{
	u8 lcd_id[12];

	sdram_init();
	LCD_Init();

	sprintf((char *)lcd_id, "LCD ID:%04X", lcddev.id); //将LCD ID打印到lcd_id数组
	// POINT_COLOR = RED;
	BACK_COLOR = RED;

	LCD_ShowString(10, 130, 240, 16, 16, lcd_id); //显示LCD ID

	gui_app_start(lcddev.height, lcddev.width);
}

int start_lcd(void)
{
	rt_err_t ret;
	lcd_thread = rt_thread_create(THREAD_NAME, lcd_entry, NULL, THREAD_STACK_SIZE, 20, 20);
	if (lcd_thread)
	{
		rt_thread_startup(lcd_thread);
		return 0;
	}
	return -1;
}

INIT_APP_EXPORT(start_lcd);
// MSH_CMD_EXPORT(start_lcd, start lcd)
